package com.unswift.generics.project;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.unswift.annotation.api.Api;
import com.unswift.annotation.api.ApiField;
import com.unswift.utils.ObjectUtils;

@Api(value="数据库表字段的映射实体", author="unswift", date="2023-04-16", version="1.0.0")
@JsonInclude(Include.NON_NULL)
public class Column {

	@ApiField("列名称")
	private String columnName;
	
	@ApiField("列描述")
	private String columnComment;
	
	@ApiField("列类型类型")
	private String columnType;
	
	@ApiField("列长度")
	private Long columnLength;
	
	@ApiField("列精度")
	private Integer columnScale;
	
	@ApiField("是否主键{true:是：false：不是}")
	private Boolean primaryKey;
	
	@ApiField("java字段名称")
	private String fieldName;
	
	@ApiField("java字段实例")
	private String fieldSampleName;
	
	@ApiField("列别名")
	private String columnAlias;
	
	@ApiField("java字段类型")
	private String fieldType;
	
	@ApiField("java字段需导入的包")
	private List<String> importPackageList;
	
	@ApiField("json格式化注解")
	private String jsonFormat;
	
	@ApiField("excel格式化注解")
	private String excelFormat;
	
	@ApiField("实体中是否生成字段")
	private boolean genericsField;
	
	@ApiField("是否自增")
	private boolean autoIncrement;

	public String getColumnName() {
		return columnName;
	}

	public void setColumnName(String columnName) {
		this.columnName = columnName;
	}

	public String getColumnComment() {
		return columnComment;
	}

	public void setColumnComment(String columnComment) {
		this.columnComment = columnComment;
	}

	public String getColumnType() {
		return columnType;
	}

	public void setColumnType(String columnType) {
		this.columnType = ObjectUtils.isEmpty(columnType)?columnType:columnType.toLowerCase();
	}

	public Long getColumnLength() {
		return columnLength;
	}

	public void setColumnLength(Long columnLength) {
		this.columnLength = columnLength;
	}

	public Integer getColumnScale() {
		return columnScale;
	}

	public void setColumnScale(Integer columnScale) {
		this.columnScale = columnScale;
	}

	public Boolean getPrimaryKey() {
		return primaryKey;
	}

	public void setPrimaryKey(Boolean primaryKey) {
		this.primaryKey = primaryKey;
	}

	public String getFieldName() {
		return fieldName;
	}

	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	public String getFieldType() {
		return fieldType;
	}

	public void setFieldType(String fieldType) {
		this.fieldType = fieldType;
	}

	public List<String> getImportPackageList() {
		return importPackageList;
	}
	
	public void addImportPackage(String importPackage) {
		if(ObjectUtils.isEmpty(this.importPackageList)){
			this.importPackageList=new ArrayList<String>();
		}
		this.importPackageList.add(importPackage);
	}

	public String getJsonFormat() {
		return jsonFormat;
	}

	public void setJsonFormat(String jsonFormat) {
		this.jsonFormat = jsonFormat;
	}

	public boolean getGenericsField() {
		return genericsField;
	}

	public void setGenericsField(boolean genericsField) {
		this.genericsField = genericsField;
	}

	public String getFieldSampleName() {
		return fieldSampleName;
	}

	public void setFieldSampleName(String fieldSampleName) {
		this.fieldSampleName = fieldSampleName;
	}

	public String getColumnAlias() {
		return columnAlias;
	}

	public void setColumnAlias(String columnAlias) {
		this.columnAlias = columnAlias;
	}

	public String getExcelFormat() {
		return excelFormat;
	}

	public void setExcelFormat(String excelFormat) {
		this.excelFormat = excelFormat;
	}

	public boolean isAutoIncrement() {
		return autoIncrement;
	}

	public void setAutoIncrement(boolean autoIncrement) {
		this.autoIncrement = autoIncrement;
	}
	
	
}
